home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / simple7a / frmmain.frm (.txt) next >
Encoding:
Visual Basic Form  |  1999-10-06  |  5.9 KB  |  210 lines

  1. VERSION 5.00
  2. Object = "{48E59290-9880-11CF-9754-00AA00C00908}#1.0#0"; "MSINET.OCX"
  3. Begin VB.Form frmMain 
  4.    Caption         =   "FTP Client "
  5.    ClientHeight    =   4605
  6.    ClientLeft      =   60
  7.    ClientTop       =   585
  8.    ClientWidth     =   8730
  9.    LinkTopic       =   "Form1"
  10.    LockControls    =   -1  'True
  11.    ScaleHeight     =   4605
  12.    ScaleWidth      =   8730
  13.    StartUpPosition =   2  'CenterScreen
  14.    Begin VB.CommandButton Command2 
  15.       Caption         =   "Upload File"
  16.       Height          =   375
  17.       Left            =   2340
  18.       TabIndex        =   12
  19.       Top             =   3480
  20.       Width           =   1395
  21.    End
  22.    Begin VB.Frame Frame2 
  23.       Caption         =   "Local Files System"
  24.       Height          =   4575
  25.       Left            =   3960
  26.       TabIndex        =   8
  27.       Top             =   0
  28.       Width           =   4695
  29.       Begin VB.FileListBox File1 
  30.          Height          =   2040
  31.          Left            =   180
  32.          TabIndex        =   11
  33.          Top             =   2400
  34.          Width           =   4335
  35.       End
  36.       Begin VB.DirListBox Dir1 
  37.          Height          =   1440
  38.          Left            =   180
  39.          TabIndex        =   10
  40.          Top             =   780
  41.          Width           =   4335
  42.       End
  43.       Begin VB.DriveListBox Drive1 
  44.          Height          =   315
  45.          Left            =   180
  46.          TabIndex        =   9
  47.          Top             =   300
  48.          Width           =   4335
  49.       End
  50.    End
  51.    Begin VB.Frame Frame1 
  52.       Caption         =   "Status"
  53.       ForeColor       =   &H00FF0000&
  54.       Height          =   675
  55.       Left            =   120
  56.       TabIndex        =   4
  57.       Top             =   3900
  58.       Width           =   3675
  59.       Begin VB.Label Label2 
  60.          BorderStyle     =   1  'Fixed Single
  61.          ForeColor       =   &H000000FF&
  62.          Height          =   435
  63.          Left            =   60
  64.          TabIndex        =   5
  65.          Top             =   180
  66.          Width           =   3555
  67.       End
  68.    End
  69.    Begin VB.CommandButton Command1 
  70.       Caption         =   "Download File"
  71.       Height          =   375
  72.       Left            =   180
  73.       TabIndex        =   3
  74.       Top             =   3480
  75.       Width           =   1335
  76.    End
  77.    Begin VB.TextBox Text1 
  78.       Height          =   285
  79.       Left            =   1020
  80.       TabIndex        =   2
  81.       Top             =   3120
  82.       Width           =   2715
  83.    End
  84.    Begin VB.ListBox List1 
  85.       Height          =   2595
  86.       Left            =   180
  87.       Sorted          =   -1  'True
  88.       TabIndex        =   0
  89.       Top             =   300
  90.       Width           =   3555
  91.    End
  92.    Begin InetCtlsObjects.Inet Inet1 
  93.       Left            =   180
  94.       Top             =   3300
  95.       _ExtentX        =   1005
  96.       _ExtentY        =   1005
  97.    End
  98.    Begin VB.Label Label4 
  99.       Caption         =   "Not Connected"
  100.       Height          =   255
  101.       Left            =   840
  102.       TabIndex        =   7
  103.       Top             =   60
  104.       Width           =   2835
  105.    End
  106.    Begin VB.Label Label3 
  107.       Caption         =   "Server:"
  108.       Height          =   255
  109.       Left            =   180
  110.       TabIndex        =   6
  111.       Top             =   60
  112.       Width           =   615
  113.    End
  114.    Begin VB.Label Label1 
  115.       Caption         =   "Selected File:"
  116.       Height          =   195
  117.       Left            =   0
  118.       TabIndex        =   1
  119.       Top             =   3120
  120.       Width           =   1035
  121.    End
  122.    Begin VB.Menu Options 
  123.       Caption         =   "Options"
  124.       Begin VB.Menu Server 
  125.          Caption         =   "Edit Server Settings"
  126.       End
  127.    End
  128. Attribute VB_Name = "frmMain"
  129. Attribute VB_GlobalNameSpace = False
  130. Attribute VB_Creatable = False
  131. Attribute VB_PredeclaredId = True
  132. Attribute VB_Exposed = False
  133. Private Sub Command1_Click()
  134. Dim LocalFile As String
  135. If Text1.Text = "" Then
  136.    MsgBox "No Server File Selected"
  137.    Exit Sub
  138. End If
  139. If Right(App.Path, 1) = "\" Then
  140.    LocalFile = App.Path & Text1.Text
  141.    LocalFile = App.Path & "\" & Text1.Text
  142. End If
  143. Command2.Enabled = False
  144. Label2.Caption = "Retreiving file: " & Text1.Text
  145. Inet1.Execute , "GET " & Text1.Text & " " & LocalFile
  146. While Inet1.StillExecuting
  147.    DoEvents
  148. Label2.Caption = "File Transfer Complete"
  149. Text1.Text = ""
  150. Command2.Enabled = True
  151. File1.Refresh
  152. End Sub
  153. Private Sub Command2_Click()
  154. Dim LocalFile As String
  155. If Text1.Text = "" Then
  156.    MsgBox "No File Selected to Upload!"
  157.    Exit Sub
  158. End If
  159. If Right(File1.Path, 1) = "\" Then
  160.    LocalFile = File1.Path & Text1.Text
  161.    LocalFile = File1.Path & "\" & Text1.Text
  162. End If
  163. Command1.Enabled = False
  164. Label2.Caption = "Sending File: " & Text1.Text
  165. frmMain.Inet1.Execute , "PUT " & LocalFile & " " & Text1.Text
  166. While frmMain.Inet1.StillExecuting
  167.    DoEvents
  168. Label2.Caption = "File Transfer Complete - Ready"
  169. RefreshServer
  170. Command2.Enabled = True
  171. End Sub
  172. Private Sub File1_Click()
  173. Command1.Enabled = False
  174. Command2.Enabled = True
  175. Text1.Text = File1.List(File1.ListIndex)
  176. End Sub
  177. Private Sub Form_Load()
  178. GoOnline = True
  179. Me.Show
  180. DoEvents
  181. If Dir(App.Path & "\login.dat", vbNormal) = "" Then
  182.    frmServer.Show 1
  183.    LogIn
  184.    LogIn
  185. End If
  186. Drive1.Drive = App.Path
  187. Dir1.Path = App.Path
  188. GoOnline = False
  189. End Sub
  190. Private Sub Form_Unload(Cancel As Integer)
  191. On Error Resume Next
  192. Inet1.Execute , "CLOSE"
  193. End Sub
  194. Private Sub List1_Click()
  195. Command2.Enabled = False
  196. Command1.Enabled = True
  197. Text1.Text = List1.List(List1.ListIndex)
  198. Label2.Caption = "Press Download Button now to retreive file"
  199. End Sub
  200. Private Sub Server_Click()
  201. frmServer.Show 1
  202. LogIn
  203. End Sub
  204. Private Sub Drive1_Change()
  205.     Dir1.Path = Drive1.Drive    ' Set directory path.
  206. End Sub
  207. Private Sub Dir1_Change()
  208.     File1.Path = Dir1.Path  ' Set file path.
  209. End Sub
  210.